package com.redsoil.house.model.http.api;

import com.redsoil.house.model.bean.CountAssetVO;
import com.redsoil.house.model.bean.DictListVO;
import com.redsoil.house.model.bean.MessageListVO;
import com.redsoil.house.model.bean.NewsVO;
import com.redsoil.house.model.bean.OneMessageVO;
import com.redsoil.house.model.bean.OnePropertyVO;
import com.redsoil.house.model.bean.PdfVO;
import com.redsoil.house.model.bean.ProductDetailVO;
import com.redsoil.house.model.bean.ProductsVO;
import com.redsoil.house.model.bean.PropertyLeaseVO;
import com.redsoil.house.model.bean.PropertyListVO;
import com.redsoil.house.model.bean.ReceiptListVO;
import com.redsoil.house.model.bean.ReceiptTotalVO;
import com.redsoil.house.model.bean.RoomEarnVO;
import com.redsoil.house.model.bean.RoomFileVO;
import com.redsoil.house.model.bean.UserVO;
import com.redsoil.house.model.http.response.HttpResponse;

import io.reactivex.Flowable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * 作者：weidingqiang on 2017/9/7 09:51
 * 邮箱：dqwei@iflytek.com
 * <p>
 * http://www.jianshu.com/p/73216939806a  Retrofit2 使用说明
 */

public interface EnglishApis {

    //登陆-相关
    @FormUrlEncoded
    @POST("user/login.do")
    Flowable<HttpResponse<UserVO>> postLogin(@Field("username") String username, @Field("password") String password);

    //登出
    @POST("user/logout.do")
    Flowable<HttpResponse<String>> logout(@Header("Authorization") String Authorization);

    //找回密码
    @FormUrlEncoded
    @POST("user/findPwd.do")
    Flowable<HttpResponse<String>> findPwd(@Field("email") String email);

    //修改密码
    @FormUrlEncoded
    @POST("user/modifyPwd.do")
    Flowable<HttpResponse<String>> modifyPwd(@Header("Authorization") String Authorization,
                                             @Field("oldPassword") String oldPassword,
                                             @Field("newPassword") String newPassword);

    //修改邮箱
    @FormUrlEncoded
    @POST("user/modifyEmail.do")
    Flowable<HttpResponse<String>> modifyEmail(@Header("Authorization") String Authorization,
                                             @Field("email") String email);

    //物业列表
    //typeCode 物业类型：BUILD 一栋/HOUSE 公寓
    @GET("realty/list.do")
    Flowable<HttpResponse<PropertyListVO>> getPropertyList(@Header("Authorization") String Authorization, @Query("typeCode") String typeCode);

    //获取单个物业信息
    @GET("realty/get-one.do")
    Flowable<HttpResponse<OnePropertyVO>> getOneProperty(@Header("Authorization") String Authorization, @Query("id") String id,
                                                         @Query("moneyTypeCode") String moneyTypeCode,@Query("type") String type);

    //获取租约信息
    @GET("realty/get-lease.do")
    Flowable<HttpResponse<PropertyLeaseVO>> getPropertyLease(@Header("Authorization") String Authorization, @Query("roomId") String roomId,@Query("moneyTypeCode") String moneyTypeCode);

    //获取房间文件
    @GET("realty/get-room-file.do")
    Flowable<HttpResponse<RoomFileVO>> getRoomFile(@Header("Authorization") String Authorization, @Query("roomId") String roomId);

    //获取房间收益统计信息
    @GET("realty/room-earning.do")
    Flowable<HttpResponse<RoomEarnVO>> getRoomEarnList(@Header("Authorization") String Authorization,
                                                       @Query("roomId") String roomId,
                                                       @Query("accountDate") String accountDate,
                                                       @Query("moneyTypeCode") String moneyTypeCode,
                                                       @Query("realtyId") String realtyId);

    //资讯列表
    @FormUrlEncoded
    @POST("info/list.do")
    Flowable<HttpResponse<NewsVO>> postNews(@Header("Authorization") String Authorization,@Field("type") String type);

    //商品列表
    @FormUrlEncoded
    @POST("product/list.do")
    Flowable<HttpResponse<ProductsVO>> postProducts(@Header("Authorization") String Authorization,
                                                    @Field("page") String page,
                                                    @Field("pageSize") String pageSize);

    //商品详细
    @FormUrlEncoded
    @POST("product/detail.do")
    Flowable<HttpResponse<ProductDetailVO>> postProductDetail(@Header("Authorization") String Authorization, @Field("id") String id);

    //提交订单
    @FormUrlEncoded
    @POST("order/save.do")
    Flowable<HttpResponse<String>> postOrder(@Header("Authorization") String Authorization,
                                             @Field("productId") String productId,
                                             @Field("price") String price,
                                             @Field("count") String count,
                                             @Field("customerMobile") String customerMobile,
                                             @Field("receivingAddr") String receivingAddr,
                                             @Field("receivingName") String receivingName,
                                             @Field("buyerMsg") String buyerMsg,
                                             @Field("type") String type,
                                             @Field("expressFee") String expressFee);

    //查询待确认事项
    @GET("message/list.do")
    Flowable<HttpResponse<MessageListVO>> getMessageList(@Header("Authorization") String Authorization,@Query("keywords") String keywords);

    //获取单个待确认事项
    @GET("message/get-one.do")
    Flowable<HttpResponse<OneMessageVO>> getOneMessage(@Header("Authorization") String Authorization, @Query("id") String id);

    //确认待确认事项
    @GET("message/affirm.do")
    Flowable<HttpResponse<String>> affirm(@Header("Authorization") String Authorization, @Query("id") String id,@Query("nowPrice") String nowPrice,@Query("isSamePrice") String isSamePrice);

    //批量设置重点消息
    @GET("message/importance.do")
    Flowable<HttpResponse<String>> importance(@Header("Authorization") String Authorization, @Query("ids") String ids,@Query("state") String state);

    //批量锁定消息
    @GET("message/lock.do")
    Flowable<HttpResponse<String>> lock(@Header("Authorization") String Authorization, @Query("ids") String ids,@Query("state") String state);

    //批量删除消息
    @GET("message/delete.do")
    Flowable<HttpResponse<String>> delete(@Header("Authorization") String Authorization, @Query("ids") String ids);

    //查询字典
    @GET("sys-dict/list.do")
    Flowable<HttpResponse<DictListVO>> getDictList(@Header("Authorization") String Authorization, @Query("type") String type);

    //汇款履历总计
    @FormUrlEncoded
    @POST("receipts/total.do")
    Flowable<HttpResponse<ReceiptTotalVO>> postReceiptTotal(@Header("Authorization") String Authorization,
                                                            @Field("moneyType") String moneyType,
                                                            @Field("paymentYear") String paymentYear);

    //汇款履历列表
    @FormUrlEncoded
    @POST("receipts/list.do")
    Flowable<HttpResponse<ReceiptListVO>> postReceiptList(@Header("Authorization") String Authorization,
                                                          @Field("moneyType") String moneyType,
                                                          @Field("paymentYear") String paymentYear);

    //首页数据
    @GET("realty/count-asset.do")
    Flowable<HttpResponse<CountAssetVO>> countAsset(@Header("Authorization") String Authorization, @Query("moneyTypeCode") String moneyTypeCode);

    //获取租金明细
    @GET("realty/export-earnings.do")
    Flowable<HttpResponse<PdfVO>> exportEarnings(@Header("Authorization") String Authorization,
                                                 @Query("exportType") String exportType,
                                                 @Query("exportVaule") String exportVaule);
}


